"use strict";
// 功能相近的程序封装成代码块
//普通函数
function findMan(age) {
    return 'find the ' + age + 'years';
}
//有可选参数的函数
function findPeople(age, name) {
    if (name) {
        return 'find the ' + age + 'years and name is' + name;
    }
    else {
        return 'find the ' + age + 'and no name!';
    }
}
//有剩余参数的函数
function findRest(age) {
    var xuqiu = [];
    for (var _i = 1; _i < arguments.length; _i++) {
        xuqiu[_i - 1] = arguments[_i];
    }
    var yy = "";
    for (var i = 0; i < xuqiu.length; i++) {
        yy = yy + xuqiu[i];
        if (i < xuqiu.length - 1) {
            yy = yy + '、';
        }
    }
    return '需求有：' + yy;
}
var age = 18;
var result = findMan(age);
var resule2 = findPeople(22, "HaoRen");
var resule3 = findRest(22, '美女', '人妖', 'SM', 'SB');
console.log(result);
console.log(resule2);
console.log(resule3);
